package com.healthtop.utils;

import org.springframework.http.HttpStatus;

import java.util.HashMap;

public class ResultResponese extends HashMap<String,Object> {

    public ResultResponese code(HttpStatus status){
        this.put("code",status.value());
        return this;
    }

    public ResultResponese message(String  msg){
        this.put("message",msg);
        return this;
    }

    public ResultResponese data(Object  data){
        this.put("data",data);
        return this;
    }

    public ResultResponese success() {
        this.code(HttpStatus.OK);
        return this;
    }

    public ResultResponese fail() {
        this.code(HttpStatus.INTERNAL_SERVER_ERROR);
        return this;
    }

    @Override
    public ResultResponese put(String key, Object value) {
        super.put(key, value);
        return this;
    }



}
